<?
/**
 * Copyright 2007 Melange.
 *
 * This file is part of PHP-MELANGE.
 *
 * PHP-MELANGE is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * PHP-MELANGE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PHP-MELANGE; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * @category    Melange
 * @package     php-melange
 * @subpackage  cms
 * @copyright   Copyright (c) 2007 Jeroen Simons. All rights reserved
 * @author      Jeroen Simons <jeroen@melange.nl>
 * @link        http://www.melange.nl/
 *
 */
?>
<?
    require_once("cms/core/om/ImagePeer.php");

    $sql = "SELECT image.image_id, binary_file.file_name, tiny_image.image_id FROM tiny_image ".
           "LEFT JOIN image ON tiny_image.thumbnail_id=image.image_id ".
           "LEFT JOIN binary_file ON image.binary_file_id=binary_file.binary_file_id ".
           "ORDER BY image.modified_date DESC";

    $con = Propel::getConnection(ImagePeer::DATABASE_NAME);
    $stmt = $con->prepareStatement($sql);
    $rs = $stmt->executeQuery(ResultSet::FETCHMODE_NUM);
    $counter = 0;

    $base = $this->request->getScheme()."://" .
            $this->request->getServerName() .
            $this->request->getContextPath() . "/";
?>
var tinyMCEImageList = new Array(<? while($rs->next()) { ?>["<?=$rs->get(2)?>", "<?=isset($_GET["newsletter"]) ? $base : ""?>image?id=<?=$rs->get(1)?>&large=<?=$rs->get(3)?>"]<?=++$counter < $rs->getRecordCount() ? "," : ""?><? } ?>);